<template>
  <div class="home-page">
    <div id="bg" :class="{ bg0: bg == 0, bg1: bg == 1, bg2: bg == 2 }"></div>
    <div id="main">
      <img id="top_words" src="../assets/index/top_words.png" alt="" />
    </div>
    <div id="last">
      <font id="timenow" style="margin-bottom: 5px"></font>
      <img src="../assets/index/bottom_words.png" alt="" id="bottom_words" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'homePage',
  data() {
    return {
      bg: '',
    };
  },
  mounted() {
    setInterval(
      "timenow.innerHTML=new Date().toLocaleString()+\
    ' 星期'+'日一二三四五六'.charAt(new Date().getDay());",
      500
    );
    this.timer = setInterval(() => {
      // 定时器
      this.bg = (this.bg + 1) % 3;
      console.log('bg', this.bg);
    }, 3000);
  },
  methods: {
    toIndex() {
      window.location.href = '/login';
    },
  },
};
</script>
<style scoped>
.home-page,
#main {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#main {
  width: 800px;
}
#top_words {
  width: 900px;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}
#login_words {
  margin-top: 10px;
  width: 140px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}
#login_words:hover {
  width: 150px;
  transition: all 1s ease;
  cursor: pointer;
}
#bottom_words {
  width: 250px;
  margin: auto;
  margin-bottom: 20px;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
}
/* //背景 */
#bg {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  z-index: -10;

  background-position: center 0;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  -webkit-background-size: cover;
  -o-background-size: cover;
  zoom: 1;
  transition: all 1s linear;
  opacity: 1;
}

.bg0 {
  /* transition: all 1s linear; */
  background-image: url('../assets/bg/0.jpeg');
}
.bg1 {
  /* transition: all 1s linear; */
  background-image: url('../assets/bg/1.jpeg');
}
.bg2 {
  /* transition: all 1s linear; */
  background-image: url('../assets/bg/3.jpeg');
}
#last {
  font-family: '楷体';
  font-size: 15px;
  display: flex;
  width: auto;
  position: fixed;
  bottom: 0;
  flex-direction: column;
  justify-content: space-around;
  text-align: center;
  color: white;
} 
#login-words:hover{
  font-size: 28px;
  transition: all 0.75s ease;
  cursor: pointer;
} 
</style>